package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.User;
import com.tanhua.dubbo.mapper.UserMapper;
import org.apache.dubbo.config.annotation.Service;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * dubbo服务
 */
@Service
public class UserApiImpl implements UserApi {

    @Autowired
    private UserMapper userMapper;
    //根据手机号查询用户
    @Override
    public User findByMobile(String mobile) {
        QueryWrapper<User> qw=new QueryWrapper<>();
        qw.eq("mobile",mobile);
        return userMapper.selectOne(qw);
    }

    //保存用户
    @Override
    public Long save(User user) {
        userMapper.insert(user);

        return user.getId();

    }
}
